package com.wsq.aidlservice.aidl;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

import java.util.concurrent.locks.ReentrantLock;

public class AIDLService extends Service {
    public AIDLService() {
        Handler handler = new Handler();
    }

    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public IBinder onBind(Intent intent) {
        Log.e("service", "onBind");
        ReentrantLock lock;
        return mBinder;
    }

    public final IServiceAidlInterface.Stub mBinder = new IServiceAidlInterface.Stub() {

        @Override
        public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {
            Log.e("service", "Thread: " + Thread.currentThread().getName());
            Log.e("service","basicTypes aDouble: " + aDouble +" anInt: " + anInt+" aBoolean " + aBoolean+" aString " + aString);
            Log.e("service", "basicTypes java 线程id：" +android.os.Process.myTid());
        }

        @Override
        public int getData(int aa) throws RemoteException {
            Log.e("service", "getData java 线程id：" +android.os.Process.myTid());
            try {
                Thread.sleep(10 * 1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            return aa + 10;
        }
    };


}
